package com.tuling.llmlangchain4j.config;

import com.tuling.llmlangchain4j.storememery.MemerryStorePersistent;
import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class XiaozhiAgentConfig {
    @Autowired
    private MemerryStorePersistent memerryStorePersistent;
    @Bean
    public ChatMemoryProvider smartChatMemoryProvider() {
        return merryId -> MessageWindowChatMemory.builder().id(merryId).maxMessages(20)
                .chatMemoryStore(memerryStorePersistent)
                .build();
    }
}
